package com.itheima.manager.util;

import com.itheima.manager.domain.ManagerMan;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Properties;
import java.util.Scanner;

public class LoginStudnetProp {
    //北京地铁管理系统登录功能实现
    private static boolean flag;

    public static boolean login() {
        try {
            flag = false;
            Properties prop = new Properties();
            FileReader fr = new FileReader("北京地铁管理系统2\\prop.properties");
            prop.load(fr);
            Scanner sc = new Scanner(System.in);
            System.out.println("请输入工号: ");
            String id = sc.next();
            System.out.println("请输入姓名: ");
            String username = sc.next();
            Object name = prop.get(id);
            if (name != null && username.equals(name)) {
                flag = true;
                System.out.println("========登录验证成功========");
            } else {
                System.out.println("========登录验证失败========");
            }
            fr.close();
        } catch (IOException e) {
            System.out.println("==========出现异常,请处理==========");
            //e.printStackTrace();
        }
        return flag;
    }


}
